package com.example.lenovo.demo;

import android.app.ProgressDialog;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.lenovo.demo.presenter.CityFirstHotAcPresenter;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

@ContentView(R.layout.activity_city_first_hot)
public class CityFirstHotActivity extends AppCompatActivity implements View.OnClickListener{
    private String id;
    private String city;
    private int num;
    @ViewInject(R.id.cityfirsthot_toolbar)
    private Toolbar toolbar;
    @ViewInject(R.id.cityfirsthot_tablayout)
    private TabLayout tabLayout;
    @ViewInject(R.id.cityfirsthot_vp)
    private ViewPager viewPager;
    @ViewInject(R.id.cityfirsthot_toolbar_imgback)
    private ImageView imageView;
    @ViewInject(R.id.cityfirsthot_toolbar_tv)
    private TextView textView;
    private ProgressDialog progressDialog;

    private CityFirstHotAcPresenter presenter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);
        Bundle bundle=getIntent().getExtras();
        id=bundle.getString("msg");
        num=bundle.getInt("num");
        city=bundle.getString("city");
        initView();
        initData();
    }

    private void initData() {
        presenter=new CityFirstHotAcPresenter();
        presenter.sendView(viewPager,this,toolbar,tabLayout,textView,id,progressDialog,getSupportFragmentManager(),num,city);
        presenter.initData();
        imageView.setOnClickListener(this);
    }

    private void initView() {
        progressDialog=new ProgressDialog(this);
        progressDialog.setTitle("提示");
        progressDialog.setMessage("正在加载...");
        progressDialog.setCancelable(true);
    }

    @Override
    public void onClick(View view) {
        finish();
    }
}
